home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / varia / interp18.lha / interp-1.8 / Context.h < prev    next >
C/C++ Source or Header  |  1990-01-20  |  2KB  |  52 lines

  1. // -*- C++ -*- Context.h --- the class declaration for a context.
  2. // Copyright (C) 1989 Carey Richard Murphey.
  3. // (rich@rice.edu) 5310 Rutherglenn, Houston, TX 77096
  4.  
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of the GNU General Public License as published by
  7. // the Free Software Foundation; either version 1, or (at your option)
  8. // any later version.
  9.  
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. // GNU General Public License for more details.
  14.  
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program; if not, write to the Free Software
  17. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19. #ifndef _Context_h_
  20. #pragma once
  21. #define _Context_h_ 1
  22. #include "Table.XPlex.h"
  23.  
  24. class Context            // an ordered set of symbol tables.
  25. {
  26. protected:
  27.   TableXPlex tab;
  28. public:
  29.                 // start with the global symbol table.
  30.   Context (Table global) {tab.add_high (global);}
  31.   ~Context () {}
  32.   Symbol& operator [] (String& name);
  33.   Table table (String& name);
  34.   int contains (String& name);
  35.   int top_level (String& name);
  36.   void open (); // open a new context
  37.   void close ();  // close a context
  38.   Table top_table () {return tab.high_element ();} // the outermost table.
  39. };
  40.  
  41. #if defined(__OPTIMIZE__) && !defined(INLINE)
  42. #define INLINE inline
  43. #include "Context.cc"
  44. #ifdef INLINE
  45. #undef INLINE
  46. #endif
  47. #endif
  48.  
  49. extern Context context;
  50.  
  51. #endif
  52.